package engine.step;

import engine.GameEngine;
import engine.UnitAction;
import engine.data.Player;

public final class DoUnitActionStep extends Step {

	private static Step step;

	private static UnitAction action;

	public static void setAction(final UnitAction anAction) {
		action = anAction;
	}

	public static synchronized Step getStep() {
		if (step == null)
			step = new DoUnitActionStep();
		return step;
	}

	public Step execute() {
		// Unit unit = GameEngine.currPlayer.currUnit;
		action.executeAction();
		// MapCanvasEngine.canvas.refreshUnitRange(unit);
		if (GameEngine.currPlayer.type == Player.HUMAN && GameEngine.currPlayer.currUnit != null
				&& !GameEngine.currPlayer.currUnit.played)
			return null;
		//if (GameEngine.currPlayer.currUnit != null && !GameEngine.currPlayer.currUnit.played)
			//return DoUnitActionStep.getStep();
		return NextUnitStep.getStep();
	}
}
